<?php
// application/resources/SessionNamespace.php
/**
 * Resource_SessionNamespace
 *
 * demo-zf application
 *
 * @author Adam Pilacki <adam.pilacki@gmail.com>
 */
final class Resource_SessionNamespace
    extends Lib_ResourceAbstract
{
    /**
     * Prepare session for specific module
     * and store it in registry
     * to get it in app: Zend_Registry::get('sessionNamespace')
     *
     * @return Zend_Session_Namespace
     */
    protected final function _getResource()
    {
        $options = $this->getOptions();

        $sessionNamespace = new Zend_Session_Namespace(isset($options['namespace']) ? $options['namespace'] : 'default');

        Zend_Registry::set('sessionNamespace', $sessionNamespace);

        return $sessionNamespace;
    }
}